package edu.study.common.util.eventbus;

import java.io.Serializable;

/**
 * 类Event.java的实现描述：
 * 
 * @author zhangjinbao 2016年1月25日 下午3:48:19
 */
public class Event implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    /**
     * bean
     */
    private Object bean;

    /**
     * 方法名
     */
    private String methodName;

    /**
     * 参数
     */
    private Object[]          args;

    /**
     * 参数类型
     */
    @SuppressWarnings("rawtypes")
    private Class[]           clazzs;

    /**
     * 构造函数
     * @param bean
     * @param methodName
     * @param args
     */
    public Event(Object bean, String methodName, Object[] args) {
        this.bean = bean;
        this.methodName = methodName;
        if(null != args){
        	this.args = new Object[args.length];
            System.arraycopy(args, 0, this.args, 0, args.length);
        }
    }

    /**
     * 
     * @param bean
     * @param methodName
     * @param args
     * @param clazzs
     */
    public Event(Object bean, String methodName, Object[] args, @SuppressWarnings("rawtypes") Class[] clazzs) {
        this.bean = bean;
        this.methodName = methodName;
        if(null != args){
        	this.args = new Object[args.length];
            System.arraycopy(args, 0, this.args, 0, args.length);
        }
        if(null != clazzs){
        	this.clazzs = new Class[clazzs.length];
            System.arraycopy(clazzs, 0, this.clazzs, 0, clazzs.length);
        }
    }

    /**
     * 
     * @return
     */
    public Object getBean() {
        return bean;
    }

    /**
     * 
     * @param bean
     */
    public void setBean(Object bean) {
        this.bean = bean;
    }

    /**
     * 
     * @return
     */
    public String getMethodName() {
        return methodName;
    }

    /**
     * 
     * @param methodName
     */
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    /**
     * 
     * @return
     */
    public Object[] getArgs() {
        return args;
    }

    /**
     * 
     * @param args
     */
    public void setArgs(Object[] args) {
        if(null != args){
        	this.args = new Object[args.length];
            System.arraycopy(args, 0, this.args, 0, args.length);
        }
    }

    /**
     * getClazzs
     * @return
     */
    @SuppressWarnings("rawtypes")
    public Class[] getClazzs() {
        return clazzs;
    }

    /**
     * setClazzs
     * @param clazzs
     */
    @SuppressWarnings("rawtypes")
    public void setClazzs(Class[] clazzs) {
        if(null != clazzs){
        	this.clazzs = new Class[clazzs.length];
            System.arraycopy(clazzs, 0, this.clazzs, 0, clazzs.length);
        }
    }
    
}
